package com.arqui.admmon_module.client.core.invalid;

import com.gwtplatform.mvp.client.ViewImpl;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class CardView extends ViewImpl implements CardPresenter.MyView {

	private final Widget widget;
	@UiField Button realTimeB;
	@UiField Button historicB;
	@UiField AbsolutePanel contentPanel;

	public interface Binder extends UiBinder<Widget, CardView> {
	}

	@Inject
	public CardView(final Binder binder) {
		widget = binder.createAndBindUi(this);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}
	

	public Button getRealTimeB() {
		return realTimeB;
	}

	public void setRealTimeB(Button realTimeB) {
		this.realTimeB = realTimeB;
	}

	public Button getHistoricB() {
		return historicB;
	}

	public void setHistoricB(Button historicB) {
		this.historicB = historicB;
	}

	public AbsolutePanel getContentPanel() {
		return contentPanel;
	}

	public void setContentPanel(AbsolutePanel contentPanel) {
		this.contentPanel = contentPanel;
	}
	
	@Override
	public void setInSlot(Object slot, Widget content) {
		if(slot == CardPresenter.SLOT_content){
			contentPanel.clear();
			
			if(content != null){
				contentPanel.add(content);
			}
		}else{
			super.setInSlot(slot, content);
		}
	}
}